function throttle(executor, wait) {
  let timeout = null;

  return function () {
    const _this = this;
    const args = arguments;
    if (timeout === null) {
      timeout = setTimeout(() => {
        executor.apply(_this, args);
        timeout = null;
      }, wait);
    }
  };
}

export default throttle;
